package basics;

/**
 * @author dataexa
 * @Date 2023/9/11
 * 重写、重载、多态测试
 */
public class OverWriterTest {
    public static void main(String[] args) {
        // 重载
        A a = new A();
        C c = new C();
        a.show(a);
        a.show(c);

        // 多态
        A aa = new AA();
        AA aa1 = new AA();
        aa.show(aa);
        aa1.showAa(aa);

        // 重写

    }
}

class A {
    String name;
    String sex;

    public void show(A obj) {
        System.out.println("A.show(A)");
    }

    public void show(C obj) {
        System.out.println("A.show(C)");
    }

}


class AA extends A {
    String aaName;


    @Override
    public void show(A obj) {
        System.out.println("AA.show(A)");
    }

    public void showAa(A obj) {
        System.out.println("AA.show(A)");
    }
}

class B extends A {
    String bName;
}

class C extends B {
    String cName;
}

class D extends C {
    String dName;

}